Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[hostmetricsreceiver] add system uptime metric #35954

Merged
merged 2 commits into from
Oct 29, 2024

Conversation

kevinnoel-be
Copy link
Contributor

Description

Add new uptime scraper to emit the system.uptime metric

Link to tracking issue

Fixes #31627

Testing

Unit test added. Also tested locally (Linux VM) with following config:

receivers:
  hostmetrics:
    scrapers:
      uptime:
exporters:
  debug:
    verbosity: detailed
service:
  pipelines:
    metrics:
      receivers:
        - hostmetrics
      exporters:
        - debug
Details

$ make genotelcontribcol
[...]

$ make RUN_CONFIG=config-uptime.yaml run
2024-10-23T13:24:48.195+0200    info    [email protected]/service.go:135 Setting up own telemetry...
2024-10-23T13:24:48.195+0200    info    telemetry/metrics.go:70 Serving metrics {"address": "localhost:8888", "metrics level": "Normal"}
2024-10-23T13:24:48.195+0200    info    builders/builders.go:26 Development component. May change in the future.        {"kind": "exporter", "data_type": "metrics", "name": "debug"}
2024-10-23T13:24:48.199+0200    info    [email protected]/service.go:207 Starting otelcontribcol...      {"Version": "0.112.0-dev", "NumCPU": 7}
2024-10-23T13:24:48.199+0200    info    extensions/extensions.go:39     Starting extensions...
2024-10-23T13:24:48.199+0200    info    [email protected]/service.go:230 Everything is ready. Begin running and processing data.
2024-10-23T13:24:49.202+0200    info    Metrics {"kind": "exporter", "data_type": "metrics", "name": "debug", "resource metrics": 1, "metrics": 1, "data points": 1}
2024-10-23T13:24:49.202+0200    info    ResourceMetrics #0
Resource SchemaURL: https://opentelemetry.io/schemas/1.9.0
ScopeMetrics #0
ScopeMetrics SchemaURL: 
InstrumentationScope github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/uptimescraper 0.112.0-dev
Metric #0
Descriptor:
     -> Name: system.uptime
     -> Description: The time the system has been running
     -> Unit: s
     -> DataType: Sum
     -> IsMonotonic: false
     -> AggregationTemporality: Cumulative
NumberDataPoints #0
StartTimestamp: 2024-10-22 18:23:22 +0000 UTC
Timestamp: 2024-10-23 11:24:49.202512199 +0000 UTC
Value: 61287.000000
        {"kind": "exporter", "data_type": "metrics", "name": "debug"}
2024-10-23T13:25:49.206+0200    info    Metrics {"kind": "exporter", "data_type": "metrics", "name": "debug", "resource metrics": 1, "metrics": 1, "data points": 1}
2024-10-23T13:25:49.206+0200    info    ResourceMetrics #0
Resource SchemaURL: https://opentelemetry.io/schemas/1.9.0
ScopeMetrics #0
ScopeMetrics SchemaURL: 
InstrumentationScope github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/uptimescraper 0.112.0-dev
Metric #0
Descriptor:
     -> Name: system.uptime
     -> Description: The time the system has been running
     -> Unit: s
     -> DataType: Sum
     -> IsMonotonic: false
     -> AggregationTemporality: Cumulative
NumberDataPoints #0
StartTimestamp: 2024-10-22 18:23:22 +0000 UTC
Timestamp: 2024-10-23 11:25:49.206657828 +0000 UTC
Value: 61347.000000
        {"kind": "exporter", "data_type": "metrics", "name": "debug"}
2024-10-23T13:26:49.205+0200    info    Metrics {"kind": "exporter", "data_type": "metrics", "name": "debug", "resource metrics": 1, "metrics": 1, "data points": 1}
2024-10-23T13:26:49.205+0200    info    ResourceMetrics #0
Resource SchemaURL: https://opentelemetry.io/schemas/1.9.0
ScopeMetrics #0
ScopeMetrics SchemaURL: 
InstrumentationScope github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/uptimescraper 0.112.0-dev
Metric #0
Descriptor:
     -> Name: system.uptime
     -> Description: The time the system has been running
     -> Unit: s
     -> DataType: Sum
     -> IsMonotonic: false
     -> AggregationTemporality: Cumulative
NumberDataPoints #0
StartTimestamp: 2024-10-22 18:23:22 +0000 UTC
Timestamp: 2024-10-23 11:26:49.2051249 +0000 UTC
Value: 61407.000000
        {"kind": "exporter", "data_type": "metrics", "name": "debug"}
2024-10-23T13:27:49.210+0200    info    Metrics {"kind": "exporter", "data_type": "metrics", "name": "debug", "resource metrics": 1, "metrics": 1, "data points": 1}
2024-10-23T13:27:49.210+0200    info    ResourceMetrics #0
Resource SchemaURL: https://opentelemetry.io/schemas/1.9.0
ScopeMetrics #0
ScopeMetrics SchemaURL: 
InstrumentationScope github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/uptimescraper 0.112.0-dev
Metric #0
Descriptor:
     -> Name: system.uptime
     -> Description: The time the system has been running
     -> Unit: s
     -> DataType: Sum
     -> IsMonotonic: false
     -> AggregationTemporality: Cumulative
NumberDataPoints #0
StartTimestamp: 2024-10-22 18:23:22 +0000 UTC
Timestamp: 2024-10-23 11:27:49.21007371 +0000 UTC
Value: 61467.000000
        {"kind": "exporter", "data_type": "metrics", "name": "debug"}
^C
2024-10-23T13:27:54.204+0200  info    [email protected]/collector.go:328       Received signal from OS {"signal": "interrupt"}
2024-10-23T13:27:54.204+0200    info    [email protected]/service.go:266 Starting shutdown...
2024-10-23T13:27:54.204+0200    info    extensions/extensions.go:66     Stopping extensions...
2024-10-23T13:27:54.204+0200    info    [email protected]/service.go:280 Shutdown complete.

Documentation

Updated readme & generated scraper docs

Copy link
Contributor

@atoulme atoulme left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job!

return err
}

s.mb = metadata.NewMetricsBuilder(s.config.MetricsBuilderConfig, s.settings, metadata.WithStartTime(pcommon.Timestamp(bootTime*1e9)))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice touch on start timestamp being set to boot time.

@kevinnoel-be
Copy link
Contributor Author

Heya @atoulme & @braydonk, based on this comment should I rename the scraper? Thanks for feedback!

@kevinnoel-be
Copy link
Contributor Author

Updated the metric to a gauge to align with the semantic convention, see discussion & reasoning in open-telemetry/semantic-conventions#1507

@kevinnoel-be kevinnoel-be marked this pull request as ready for review October 28, 2024 10:40
@kevinnoel-be kevinnoel-be requested a review from a team as a code owner October 28, 2024 10:40
@MovieStoreGuy MovieStoreGuy merged commit e7ae19d into open-telemetry:main Oct 29, 2024
160 checks passed
@github-actions github-actions bot added this to the next release milestone Oct 29, 2024
@kevinnoel-be kevinnoel-be deleted the add-system-uptime branch October 29, 2024 08:55
jpbarto pushed a commit to jpbarto/opentelemetry-collector-contrib that referenced this pull request Oct 29, 2024
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
Add new uptime scraper to emit the `system.uptime` metric

<!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
Fixes open-telemetry#31627 

<!--Describe what testing was performed and which tests were added.-->
#### Testing
Unit test added. Also tested locally (Linux VM) with following config:
```yaml
receivers:
  hostmetrics:
    scrapers:
      uptime:
exporters:
  debug:
    verbosity: detailed
service:
  pipelines:
    metrics:
      receivers:
        - hostmetrics
      exporters:
        - debug
```
<details><summary>Details</summary>
<p>

```console
$ make genotelcontribcol
[...]

$ make RUN_CONFIG=config-uptime.yaml run
2024-10-23T13:24:48.195+0200    info    [email protected]/service.go:135 Setting up own telemetry...
2024-10-23T13:24:48.195+0200    info    telemetry/metrics.go:70 Serving metrics {"address": "localhost:8888", "metrics level": "Normal"}
2024-10-23T13:24:48.195+0200    info    builders/builders.go:26 Development component. May change in the future.        {"kind": "exporter", "data_type": "metrics", "name": "debug"}
2024-10-23T13:24:48.199+0200    info    [email protected]/service.go:207 Starting otelcontribcol...      {"Version": "0.112.0-dev", "NumCPU": 7}
2024-10-23T13:24:48.199+0200    info    extensions/extensions.go:39     Starting extensions...
2024-10-23T13:24:48.199+0200    info    [email protected]/service.go:230 Everything is ready. Begin running and processing data.
2024-10-23T13:24:49.202+0200    info    Metrics {"kind": "exporter", "data_type": "metrics", "name": "debug", "resource metrics": 1, "metrics": 1, "data points": 1}
2024-10-23T13:24:49.202+0200    info    ResourceMetrics #0
Resource SchemaURL: https://opentelemetry.io/schemas/1.9.0
ScopeMetrics #0
ScopeMetrics SchemaURL: 
InstrumentationScope github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/uptimescraper 0.112.0-dev
Metric #0
Descriptor:
     -> Name: system.uptime
     -> Description: The time the system has been running
     -> Unit: s
     -> DataType: Sum
     -> IsMonotonic: false
     -> AggregationTemporality: Cumulative
NumberDataPoints #0
StartTimestamp: 2024-10-22 18:23:22 +0000 UTC
Timestamp: 2024-10-23 11:24:49.202512199 +0000 UTC
Value: 61287.000000
        {"kind": "exporter", "data_type": "metrics", "name": "debug"}
2024-10-23T13:25:49.206+0200    info    Metrics {"kind": "exporter", "data_type": "metrics", "name": "debug", "resource metrics": 1, "metrics": 1, "data points": 1}
2024-10-23T13:25:49.206+0200    info    ResourceMetrics #0
Resource SchemaURL: https://opentelemetry.io/schemas/1.9.0
ScopeMetrics #0
ScopeMetrics SchemaURL: 
InstrumentationScope github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/uptimescraper 0.112.0-dev
Metric #0
Descriptor:
     -> Name: system.uptime
     -> Description: The time the system has been running
     -> Unit: s
     -> DataType: Sum
     -> IsMonotonic: false
     -> AggregationTemporality: Cumulative
NumberDataPoints #0
StartTimestamp: 2024-10-22 18:23:22 +0000 UTC
Timestamp: 2024-10-23 11:25:49.206657828 +0000 UTC
Value: 61347.000000
        {"kind": "exporter", "data_type": "metrics", "name": "debug"}
2024-10-23T13:26:49.205+0200    info    Metrics {"kind": "exporter", "data_type": "metrics", "name": "debug", "resource metrics": 1, "metrics": 1, "data points": 1}
2024-10-23T13:26:49.205+0200    info    ResourceMetrics #0
Resource SchemaURL: https://opentelemetry.io/schemas/1.9.0
ScopeMetrics #0
ScopeMetrics SchemaURL: 
InstrumentationScope github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/uptimescraper 0.112.0-dev
Metric #0
Descriptor:
     -> Name: system.uptime
     -> Description: The time the system has been running
     -> Unit: s
     -> DataType: Sum
     -> IsMonotonic: false
     -> AggregationTemporality: Cumulative
NumberDataPoints #0
StartTimestamp: 2024-10-22 18:23:22 +0000 UTC
Timestamp: 2024-10-23 11:26:49.2051249 +0000 UTC
Value: 61407.000000
        {"kind": "exporter", "data_type": "metrics", "name": "debug"}
2024-10-23T13:27:49.210+0200    info    Metrics {"kind": "exporter", "data_type": "metrics", "name": "debug", "resource metrics": 1, "metrics": 1, "data points": 1}
2024-10-23T13:27:49.210+0200    info    ResourceMetrics #0
Resource SchemaURL: https://opentelemetry.io/schemas/1.9.0
ScopeMetrics #0
ScopeMetrics SchemaURL: 
InstrumentationScope github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/uptimescraper 0.112.0-dev
Metric #0
Descriptor:
     -> Name: system.uptime
     -> Description: The time the system has been running
     -> Unit: s
     -> DataType: Sum
     -> IsMonotonic: false
     -> AggregationTemporality: Cumulative
NumberDataPoints #0
StartTimestamp: 2024-10-22 18:23:22 +0000 UTC
Timestamp: 2024-10-23 11:27:49.21007371 +0000 UTC
Value: 61467.000000
        {"kind": "exporter", "data_type": "metrics", "name": "debug"}
^C
2024-10-23T13:27:54.204+0200  info    [email protected]/collector.go:328       Received signal from OS {"signal": "interrupt"}
2024-10-23T13:27:54.204+0200    info    [email protected]/service.go:266 Starting shutdown...
2024-10-23T13:27:54.204+0200    info    extensions/extensions.go:66     Stopping extensions...
2024-10-23T13:27:54.204+0200    info    [email protected]/service.go:280 Shutdown complete.
```

</p>
</details> 


<!--Describe the documentation added.-->
#### Documentation
Updated readme & generated scraper docs

<!--Please delete paragraphs that you did not use before submitting.-->
@braydonk
Copy link
Contributor

Thank you for this feature @kevinnoel-be!

I was out for too long and missed this one coming by, so was unable to get through my feedback that I maintain the scraper should be named system. I will submit a PR making this change.

djaglowski pushed a commit that referenced this pull request Nov 5, 2024
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
This PR makes some changes that I had hoped to suggest on #35954,
however I was unable to make my comment in time before the PR was
merged.

The changes this PR makes are:
* The `uptime` scraper is changed to be named `system`
* The scraper is registered using the scraper name when adding to the
scrapercontroller

<!-- Issue number (e.g. #1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
Amends the fix to #31627 (following a comment I made on #35932)

<!--Describe what testing was performed and which tests were added.-->
#### Testing

<!--Describe the documentation added.-->
#### Documentation

The documentation that was added for the `uptime` scraper was renamed
accordingly, and the description adjusted.

<!--Please delete paragraphs that you did not use before submitting.-->
michael-burt pushed a commit to michael-burt/opentelemetry-collector-contrib that referenced this pull request Nov 7, 2024
…-telemetry#36123)

<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
This PR makes some changes that I had hoped to suggest on open-telemetry#35954,
however I was unable to make my comment in time before the PR was
merged.

The changes this PR makes are:
* The `uptime` scraper is changed to be named `system`
* The scraper is registered using the scraper name when adding to the
scrapercontroller

<!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
Amends the fix to open-telemetry#31627 (following a comment I made on open-telemetry#35932)

<!--Describe what testing was performed and which tests were added.-->
#### Testing

<!--Describe the documentation added.-->
#### Documentation

The documentation that was added for the `uptime` scraper was renamed
accordingly, and the description adjusted.

<!--Please delete paragraphs that you did not use before submitting.-->
zzhlogin pushed a commit to zzhlogin/opentelemetry-collector-contrib-aws that referenced this pull request Nov 12, 2024
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
Add new uptime scraper to emit the `system.uptime` metric

<!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
Fixes open-telemetry#31627 

<!--Describe what testing was performed and which tests were added.-->
#### Testing
Unit test added. Also tested locally (Linux VM) with following config:
```yaml
receivers:
  hostmetrics:
    scrapers:
      uptime:
exporters:
  debug:
    verbosity: detailed
service:
  pipelines:
    metrics:
      receivers:
        - hostmetrics
      exporters:
        - debug
```
<details><summary>Details</summary>
<p>

```console
$ make genotelcontribcol
[...]

$ make RUN_CONFIG=config-uptime.yaml run
2024-10-23T13:24:48.195+0200    info    [email protected]/service.go:135 Setting up own telemetry...
2024-10-23T13:24:48.195+0200    info    telemetry/metrics.go:70 Serving metrics {"address": "localhost:8888", "metrics level": "Normal"}
2024-10-23T13:24:48.195+0200    info    builders/builders.go:26 Development component. May change in the future.        {"kind": "exporter", "data_type": "metrics", "name": "debug"}
2024-10-23T13:24:48.199+0200    info    [email protected]/service.go:207 Starting otelcontribcol...      {"Version": "0.112.0-dev", "NumCPU": 7}
2024-10-23T13:24:48.199+0200    info    extensions/extensions.go:39     Starting extensions...
2024-10-23T13:24:48.199+0200    info    [email protected]/service.go:230 Everything is ready. Begin running and processing data.
2024-10-23T13:24:49.202+0200    info    Metrics {"kind": "exporter", "data_type": "metrics", "name": "debug", "resource metrics": 1, "metrics": 1, "data points": 1}
2024-10-23T13:24:49.202+0200    info    ResourceMetrics #0
Resource SchemaURL: https://opentelemetry.io/schemas/1.9.0
ScopeMetrics #0
ScopeMetrics SchemaURL: 
InstrumentationScope github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/uptimescraper 0.112.0-dev
Metric #0
Descriptor:
     -> Name: system.uptime
     -> Description: The time the system has been running
     -> Unit: s
     -> DataType: Sum
     -> IsMonotonic: false
     -> AggregationTemporality: Cumulative
NumberDataPoints #0
StartTimestamp: 2024-10-22 18:23:22 +0000 UTC
Timestamp: 2024-10-23 11:24:49.202512199 +0000 UTC
Value: 61287.000000
        {"kind": "exporter", "data_type": "metrics", "name": "debug"}
2024-10-23T13:25:49.206+0200    info    Metrics {"kind": "exporter", "data_type": "metrics", "name": "debug", "resource metrics": 1, "metrics": 1, "data points": 1}
2024-10-23T13:25:49.206+0200    info    ResourceMetrics #0
Resource SchemaURL: https://opentelemetry.io/schemas/1.9.0
ScopeMetrics #0
ScopeMetrics SchemaURL: 
InstrumentationScope github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/uptimescraper 0.112.0-dev
Metric #0
Descriptor:
     -> Name: system.uptime
     -> Description: The time the system has been running
     -> Unit: s
     -> DataType: Sum
     -> IsMonotonic: false
     -> AggregationTemporality: Cumulative
NumberDataPoints #0
StartTimestamp: 2024-10-22 18:23:22 +0000 UTC
Timestamp: 2024-10-23 11:25:49.206657828 +0000 UTC
Value: 61347.000000
        {"kind": "exporter", "data_type": "metrics", "name": "debug"}
2024-10-23T13:26:49.205+0200    info    Metrics {"kind": "exporter", "data_type": "metrics", "name": "debug", "resource metrics": 1, "metrics": 1, "data points": 1}
2024-10-23T13:26:49.205+0200    info    ResourceMetrics #0
Resource SchemaURL: https://opentelemetry.io/schemas/1.9.0
ScopeMetrics #0
ScopeMetrics SchemaURL: 
InstrumentationScope github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/uptimescraper 0.112.0-dev
Metric #0
Descriptor:
     -> Name: system.uptime
     -> Description: The time the system has been running
     -> Unit: s
     -> DataType: Sum
     -> IsMonotonic: false
     -> AggregationTemporality: Cumulative
NumberDataPoints #0
StartTimestamp: 2024-10-22 18:23:22 +0000 UTC
Timestamp: 2024-10-23 11:26:49.2051249 +0000 UTC
Value: 61407.000000
        {"kind": "exporter", "data_type": "metrics", "name": "debug"}
2024-10-23T13:27:49.210+0200    info    Metrics {"kind": "exporter", "data_type": "metrics", "name": "debug", "resource metrics": 1, "metrics": 1, "data points": 1}
2024-10-23T13:27:49.210+0200    info    ResourceMetrics #0
Resource SchemaURL: https://opentelemetry.io/schemas/1.9.0
ScopeMetrics #0
ScopeMetrics SchemaURL: 
InstrumentationScope github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/uptimescraper 0.112.0-dev
Metric #0
Descriptor:
     -> Name: system.uptime
     -> Description: The time the system has been running
     -> Unit: s
     -> DataType: Sum
     -> IsMonotonic: false
     -> AggregationTemporality: Cumulative
NumberDataPoints #0
StartTimestamp: 2024-10-22 18:23:22 +0000 UTC
Timestamp: 2024-10-23 11:27:49.21007371 +0000 UTC
Value: 61467.000000
        {"kind": "exporter", "data_type": "metrics", "name": "debug"}
^C
2024-10-23T13:27:54.204+0200  info    [email protected]/collector.go:328       Received signal from OS {"signal": "interrupt"}
2024-10-23T13:27:54.204+0200    info    [email protected]/service.go:266 Starting shutdown...
2024-10-23T13:27:54.204+0200    info    extensions/extensions.go:66     Stopping extensions...
2024-10-23T13:27:54.204+0200    info    [email protected]/service.go:280 Shutdown complete.
```

</p>
</details> 


<!--Describe the documentation added.-->
#### Documentation
Updated readme & generated scraper docs

<!--Please delete paragraphs that you did not use before submitting.-->
sbylica-splunk pushed a commit to sbylica-splunk/opentelemetry-collector-contrib that referenced this pull request Dec 17, 2024
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
Add new uptime scraper to emit the `system.uptime` metric

<!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
Fixes open-telemetry#31627 

<!--Describe what testing was performed and which tests were added.-->
#### Testing
Unit test added. Also tested locally (Linux VM) with following config:
```yaml
receivers:
  hostmetrics:
    scrapers:
      uptime:
exporters:
  debug:
    verbosity: detailed
service:
  pipelines:
    metrics:
      receivers:
        - hostmetrics
      exporters:
        - debug
```
<details><summary>Details</summary>
<p>

```console
$ make genotelcontribcol
[...]

$ make RUN_CONFIG=config-uptime.yaml run
2024-10-23T13:24:48.195+0200    info    [email protected]/service.go:135 Setting up own telemetry...
2024-10-23T13:24:48.195+0200    info    telemetry/metrics.go:70 Serving metrics {"address": "localhost:8888", "metrics level": "Normal"}
2024-10-23T13:24:48.195+0200    info    builders/builders.go:26 Development component. May change in the future.        {"kind": "exporter", "data_type": "metrics", "name": "debug"}
2024-10-23T13:24:48.199+0200    info    [email protected]/service.go:207 Starting otelcontribcol...      {"Version": "0.112.0-dev", "NumCPU": 7}
2024-10-23T13:24:48.199+0200    info    extensions/extensions.go:39     Starting extensions...
2024-10-23T13:24:48.199+0200    info    [email protected]/service.go:230 Everything is ready. Begin running and processing data.
2024-10-23T13:24:49.202+0200    info    Metrics {"kind": "exporter", "data_type": "metrics", "name": "debug", "resource metrics": 1, "metrics": 1, "data points": 1}
2024-10-23T13:24:49.202+0200    info    ResourceMetrics #0
Resource SchemaURL: https://opentelemetry.io/schemas/1.9.0
ScopeMetrics #0
ScopeMetrics SchemaURL: 
InstrumentationScope github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/uptimescraper 0.112.0-dev
Metric #0
Descriptor:
     -> Name: system.uptime
     -> Description: The time the system has been running
     -> Unit: s
     -> DataType: Sum
     -> IsMonotonic: false
     -> AggregationTemporality: Cumulative
NumberDataPoints #0
StartTimestamp: 2024-10-22 18:23:22 +0000 UTC
Timestamp: 2024-10-23 11:24:49.202512199 +0000 UTC
Value: 61287.000000
        {"kind": "exporter", "data_type": "metrics", "name": "debug"}
2024-10-23T13:25:49.206+0200    info    Metrics {"kind": "exporter", "data_type": "metrics", "name": "debug", "resource metrics": 1, "metrics": 1, "data points": 1}
2024-10-23T13:25:49.206+0200    info    ResourceMetrics #0
Resource SchemaURL: https://opentelemetry.io/schemas/1.9.0
ScopeMetrics #0
ScopeMetrics SchemaURL: 
InstrumentationScope github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/uptimescraper 0.112.0-dev
Metric #0
Descriptor:
     -> Name: system.uptime
     -> Description: The time the system has been running
     -> Unit: s
     -> DataType: Sum
     -> IsMonotonic: false
     -> AggregationTemporality: Cumulative
NumberDataPoints #0
StartTimestamp: 2024-10-22 18:23:22 +0000 UTC
Timestamp: 2024-10-23 11:25:49.206657828 +0000 UTC
Value: 61347.000000
        {"kind": "exporter", "data_type": "metrics", "name": "debug"}
2024-10-23T13:26:49.205+0200    info    Metrics {"kind": "exporter", "data_type": "metrics", "name": "debug", "resource metrics": 1, "metrics": 1, "data points": 1}
2024-10-23T13:26:49.205+0200    info    ResourceMetrics #0
Resource SchemaURL: https://opentelemetry.io/schemas/1.9.0
ScopeMetrics #0
ScopeMetrics SchemaURL: 
InstrumentationScope github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/uptimescraper 0.112.0-dev
Metric #0
Descriptor:
     -> Name: system.uptime
     -> Description: The time the system has been running
     -> Unit: s
     -> DataType: Sum
     -> IsMonotonic: false
     -> AggregationTemporality: Cumulative
NumberDataPoints #0
StartTimestamp: 2024-10-22 18:23:22 +0000 UTC
Timestamp: 2024-10-23 11:26:49.2051249 +0000 UTC
Value: 61407.000000
        {"kind": "exporter", "data_type": "metrics", "name": "debug"}
2024-10-23T13:27:49.210+0200    info    Metrics {"kind": "exporter", "data_type": "metrics", "name": "debug", "resource metrics": 1, "metrics": 1, "data points": 1}
2024-10-23T13:27:49.210+0200    info    ResourceMetrics #0
Resource SchemaURL: https://opentelemetry.io/schemas/1.9.0
ScopeMetrics #0
ScopeMetrics SchemaURL: 
InstrumentationScope github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/uptimescraper 0.112.0-dev
Metric #0
Descriptor:
     -> Name: system.uptime
     -> Description: The time the system has been running
     -> Unit: s
     -> DataType: Sum
     -> IsMonotonic: false
     -> AggregationTemporality: Cumulative
NumberDataPoints #0
StartTimestamp: 2024-10-22 18:23:22 +0000 UTC
Timestamp: 2024-10-23 11:27:49.21007371 +0000 UTC
Value: 61467.000000
        {"kind": "exporter", "data_type": "metrics", "name": "debug"}
^C
2024-10-23T13:27:54.204+0200  info    [email protected]/collector.go:328       Received signal from OS {"signal": "interrupt"}
2024-10-23T13:27:54.204+0200    info    [email protected]/service.go:266 Starting shutdown...
2024-10-23T13:27:54.204+0200    info    extensions/extensions.go:66     Stopping extensions...
2024-10-23T13:27:54.204+0200    info    [email protected]/service.go:280 Shutdown complete.
```

</p>
</details> 


<!--Describe the documentation added.-->
#### Documentation
Updated readme & generated scraper docs

<!--Please delete paragraphs that you did not use before submitting.-->
sbylica-splunk pushed a commit to sbylica-splunk/opentelemetry-collector-contrib that referenced this pull request Dec 17, 2024
…-telemetry#36123)

<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
This PR makes some changes that I had hoped to suggest on open-telemetry#35954,
however I was unable to make my comment in time before the PR was
merged.

The changes this PR makes are:
* The `uptime` scraper is changed to be named `system`
* The scraper is registered using the scraper name when adding to the
scrapercontroller

<!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
Amends the fix to open-telemetry#31627 (following a comment I made on open-telemetry#35932)

<!--Describe what testing was performed and which tests were added.-->
#### Testing

<!--Describe the documentation added.-->
#### Documentation

The documentation that was added for the `uptime` scraper was renamed
accordingly, and the description adjusted.

<!--Please delete paragraphs that you did not use before submitting.-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Additional system attributes
5 participants